package com.mq.batch.consumer1;

import org.springframework.amqp.rabbit.core.BatchingRabbitTemplate;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author ytj
 * @date 2024/1/15
 */
@Component
public class Demo5Producer {

    @Resource
    private BatchingRabbitTemplate rabbitTemplate;

    public void send(Integer id){
        System.out.println("开始发送消息:"+id);
        Demo5Message demo5Message=new Demo5Message(id);
        this.rabbitTemplate.convertAndSend(Demo5Message.EXCHANGE_NAME,Demo5Message.ROUTE_KEY,demo5Message);
    }
}
